﻿// calendarBar.cpp
#include "pch.h"
#include "calendarBar.h"

IMPLEMENT_DYNAMIC(calendarBar, CBCGPDialog)

calendarBar::calendarBar(CWnd* pParent)
	: CBCGPDialog(IDD_DATERANGE_DLG, pParent)
{
}

calendarBar::~calendarBar()
{
}

void calendarBar::DoDataExchange(CDataExchange* pDX)
{
	CBCGPDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_CAL_START, m_calStart);
	DDX_Control(pDX, IDC_CAL_END, m_calEnd);
	DDX_Control(pDX, IDC_MONTHCALENDAR1, m_startCal);
}

BEGIN_MESSAGE_MAP(calendarBar, CBCGPDialog)
END_MESSAGE_MAP()

BOOL calendarBar::OnInitDialog()
{
	CBCGPDialog::OnInitDialog();

	// 获取主窗口指针
/*	CWnd* pParent = GetParent();
	if (pParent != nullptr)
	{
		CRect rcBtn;
		// 用你的主对话框类名替换CMFCApplication2Dlg
		((CMFCApplication2Dlg*)pParent)->m_btnPeriod.GetWindowRect(&rcBtn);

		// 获取弹窗大小
		CRect rcDlg;
		GetWindowRect(&rcDlg);
		int dlgWidth = rcDlg.Width();
		int dlgHeight = rcDlg.Height();

		// 计算新位置
		int x = rcBtn.left;
		int y = rcBtn.bottom;

		// 移动弹窗
		SetWindowPos(NULL, x, y, dlgWidth, dlgHeight, SWP_NOZORDER | SWP_NOSIZE);
	}
*/
	return TRUE;
}